"""
@Time ： 2022/10/17 10:41
@Auth ： 陈杰 200320501042
@E-mail : 1612845322@qq.com
"""
from inspect import isfunction


class MyClass:
    attr1 = 111
    __attr2 = 222  # 带下划线的私有属性
    attr3 = attr1 + __attr2

    def showAttrs(self):
        for x in self.__class__.__dict__.items():
            if isfunction(x[1]):
                print("成员方法：{0}".format(x[0]))
            elif type(x[1]) == int:
                if x[0].find("_MyClass") == -1:
                    print("共有属性：{0}:值：{1}".format(x[0], x[1]))
                else:
                    print("私有属性：{0}：值：{1}".format(x[0], x[1]))


if __name__ == '__main__':
    MyClass().showAttrs()
    print("-" * 60)
    MyClass.attr1 = 555
    MyClass._MyClass__attr2 = 777
    MyClass.attr4 = 666
    MyClass.attr5 = 999
    MyClass().showAttrs()
